import Vue from "vue";
import axios from "axios";

// 请求拦截器
axios.interceptors.request.use(config => {
    const token = window.sessionStorage.getItem("token");
    if (token) config.headers.token = token;
    return config;
});

// 响应拦截器
axios.interceptors.response.use(res => {
    return res.data;
});

Vue.prototype.$http = axios;
